package com.artPreter.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 输入设备表
 * </p>
 *
 * @author Jarvis_He
 * @since 2024-04-22
 */
@Data
@TableName("jv_input_device")
public class InputDevice implements Serializable {

    private static final long serialVersionUID = 1L;

    //ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    //主机uuid")
    @TableField("uuid")
    private String uuid;

    //创建时间")
    @TableField("create_time")
    private Integer createTime;

    //排序")
    @TableField("sort")
    private Integer sort;

    //备注")
    @TableField("remarks")
    private String remarks;

    //启用：1 禁用:0")
    @TableField("status")
    private Integer status;

    //房间id")
    @TableField("room")
    private String room;

    //楼层id")
    @TableField("floor")
    private String floor;

    //区域id")
    @TableField("position")
    private String position;

    //使用设备id")
    @TableField("device_id")
    private String deviceId;

    //使用设备名称")
    @TableField("device_name")
    private String deviceName;

    //主机uuid")
    @TableField("main_id")
    private String mainId;

    //主机设备id")
    @TableField("main_device_id")
    private String mainDeviceId;

    //设备坐标")
    @TableField("loc_x")
    private Double locX;

    //设备坐标")
    @TableField("loc_y")
    private Double locY;

    //阀值")
    @TableField("over_value")
    private String overValue;

    //阀值")
    @TableField("over_value2")
    private String overValue2;

    //阀值")
    @TableField("over_value3")
    private String overValue3;

    //阀值")
    @TableField("over_value4")
    private String overValue4;

    //是否在室外 1:室内 0：室外
    @TableField("indoor")
    private Integer inDoor;

    @TableField("ot1")
    private Integer ot1;

    @TableField("ot2")
    private Integer ot2;

    @TableField("ot3")
    private Integer ot3;

    @TableField("ot4")
    private Integer ot4;


    public InputDevice() {
    }

    public InputDevice(InputDevice inputDevice, Integer type) {
        switch (type){
            case 1: // 修改
                // 排序
                this.sort = inputDevice.getSort();
                // 备注
                this.remarks = inputDevice.getRemarks();
                // 库房id
                this.room = inputDevice.getRoom();
                // 楼层id
                this.floor = inputDevice.getFloor();
                // 区域id
                this.position = inputDevice.getPosition();
                // 使用设备id
                this.deviceId = inputDevice.getDeviceId();
                // 使用设备名称
                this.deviceName = inputDevice.getDeviceName();
                // 设备坐标x
                this.locX = inputDevice.getLocX();
                // 设备坐标Y
                this.locY = inputDevice.getLocY();
                // 主机UUID
                this.mainId = inputDevice.getMainId();
                // 阈值
                this.overValue = inputDevice.getOverValue();
                this.overValue2 = inputDevice.getOverValue2();    //
                this.overValue3 = inputDevice.getOverValue3();
                this.overValue4 = inputDevice.getOverValue4();
                // 延迟
                this.ot1 = inputDevice.getOt1();
                this.ot2 = inputDevice.getOt2();
                this.ot3 = inputDevice.getOt3();
                this.ot4 = inputDevice.getOt4();
                break;
            case 2:
                if(inputDevice.getStatus()==0){
                    this.status = 1;
                }else{
                    this.status = 0;
                }
                break;//
        }
    }
}
